import { createRouter, createWebHistory } from 'vue-router';
import LoginForm from '@/views/user/LoginForm.vue';
import RegisterForm from '@/views/user/RegisterForm.vue';
import BlogHome from '@/views/BlogHome.vue';
import CreatePost from "@/views/posts/CreatePost.vue";
import EditPost from "@/views/posts/EditPost.vue";
const routes = [
    { path: '/', redirect: '/home' },
    { path: '/home', component: BlogHome },
    { path: '/login', component: LoginForm },
    { path: '/register', component: RegisterForm },
    { path: '/create-post', component: CreatePost },
    { path: '/edit-post/:id', component: EditPost },
    {
        path: '/post/:id',
        name: 'PostDetail',
        component: () => import('@/views/posts/PostDetail.vue') // 详情页面
    },
    {
        path: '/profile',
        name: 'Profile',
        component: () => import('@/views/user/Profile.vue') //  编辑信息页面
    },
    {
        path: '/info',
        name: 'Info',
        component: () =>import('@/views/user/Info.vue')   //个人信息页面
    }

];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

export default router;
